package jp.isisredirect.DreamWaverFirst;

import android.view.ViewGroup;

public class ManualController extends AccessoryController {

	private boolean mVertical;
	private FreqController mFreqC1 ;
	private FreqController mFreqC2 ;
	
	ManualController(DreamWaverFirstActivity hostActivity, boolean vertical) {
		super(hostActivity);
		mVertical = vertical;
	}

	protected void onAccesssoryAttached() {
		mFreqC1 = new FreqController(mHostActivity, 0, getResources(), mVertical);
		mFreqC1.attachToView((ViewGroup) findViewById(R.id.freq1));		
		mFreqC2 = new FreqController(mHostActivity, 6, getResources(), mVertical);
		mFreqC2.attachToView((ViewGroup) findViewById(R.id.freq2));		

		setupPlayButtonController(R.id.playButton);
		setupMuteButtonController(R.id.muteButton);
		setupRecButtonController(R.id.recButton);
	}
	
	ManualPlayButtonController mPlayButton ;
	MuteButtonController mMuteButton;
	RecButtonController mRecButton;
	
	private void setupPlayButtonController(int viewId) {
		mPlayButton = new ManualPlayButtonController(mHostActivity, 0, getResources(), mVertical);
		mPlayButton.attachToView(findViewById(viewId));
	}
	private void setupMuteButtonController(int viewId) {
		mMuteButton = new MuteButtonController(mHostActivity, 0, getResources(), mVertical);
		mMuteButton.attachToView(findViewById(viewId));
	}
	private void setupRecButtonController(int viewId) {
		mRecButton = new RecButtonController(mHostActivity, 0, getResources(), mVertical);
		mRecButton.attachToView(findViewById(viewId));
	}
	
	public void sendAllFreq()
	{
		mFreqC1.sendAll((ViewGroup)findViewById(R.id.freq1));
		mFreqC2.sendAll((ViewGroup)findViewById(R.id.freq2));		
	}
	
	public void resetControls() {
		mPlayButton.resetButton();
		mMuteButton.resetButton();
		mRecButton.resetButton();

	}
}
